function vtk3d_all

%fbase = 'example3d'; fnum  = 20;
%jx=48; jy=48; jz=16;   % box size


fbase = 'jd08a'; fnum  = 59;
jx=96; jy=96; jz=32;   % box size



%--------------------------

  fn = num2str(fnum,'%04d');

%-- density

  %fname = [fbase, '.dn.', fn];
  fname = 'jd08a.uy.0059.00';

  fid = fopen(fname, 'rb');
  v = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  v = reshape(v, jz,jy,jx);
  v = flipxz(v);

  %vtk3d_any(v, 'dn', [fname, '.vtk'])
  vtk3d_any(v, 'uy', [fname, '.vtk'])

return

%-- electic field: Ex

  fname = [fbase, '.Ex.', fn];

  fid = fopen(fname, 'rb');
  v = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  v = reshape(v, jz,jy,jx);
  v = flipxz(v);

  vtk3d_any(v, 'Ex', [fname, '.vtk'])


%-- electic field: Ey

  fname = [fbase, '.Ey.', fn];

  fid = fopen(fname, 'rb');
  v = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  v = reshape(v, jz,jy,jx);
  v = flipxz(v);

  vtk3d_any(v, 'Ey', [fname, '.vtk'])


%-- electic field: Ez

  fname = [fbase, '.Ez.', fn];

  fid = fopen(fname, 'rb');
  v = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  v = reshape(v, jz,jy,jx);
  v = flipxz(v);

  vtk3d_any(v, 'Ez', [fname, '.vtk'])


end


%---------------------------------------------------------

function fv = flipxz(v)

  [jz,jy,jx] = size(v);
  fv = zeros(jx,jy,jz);

  for j=1:jy
    a = v(:,j,:);
    a = reshape(a, jz, jx);
    fv(:,j,:) = a';
  end

end

%---------------------------------------------------------
